package com.servlet.rootoperator;

import com.Impl.BookCRUD;
import com.alibaba.fastjson.JSON;
import com.entity.Book;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "QueryAllBooksServlet", value = "/QueryBooksCountServlet")
public class QueryBooksCountServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        BookCRUD bookCRUD = new BookCRUD();
        response.setContentType("text/html;charset=utf8");
        Long count = bookCRUD.queryBooksCount();
        response.getWriter().println(count);
    }

}
